<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>
<!DOCTYPE HTML>
<html>
	<head>
	<%@ include file="/common/include/title.jsp" %>	
	<script type="text/javascript" src="${rootPath }/lib/My97DatePicker/WdatePicker.js"></script>
	<!-- 配置百度编译器 -->
	 <script type="text/javascript" charset="utf-8" src="${rootPath }/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="${rootPath }/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="${rootPath }/ueditor/lang/zh-cn/zh-cn.js"></script>
	<title>商品更新- 商城后台</title>
	</head>
	<body>
		<div class="pd-20">
			<form action="${rootPath }/back/goods/goodsUpdateSubmit.htm" method="post" class="form form-horizontal"
				id="form-article-add" enctype="multipart/form-data">
				<div class="row cl">
					<label class="form-label col-2">ID：</label>
					<span class="formControls col-2">
						<input type="text" class="input-text" name="gid"  value="${requestScope.goods.id }" readonly="readonly">
						<span class="c-red" >(只读项,不可修改!)</span>
					</span>
				</div>
				<div class="row cl">
					<label class="form-label col-2">分类：</label>
					<div class="formControls col-2">
						<select name="cateId"  class="input-text" >
							<c:forEach items="${requestScope.goodsCategoryTreeArr }" var="goodsCategoryTree" varStatus="stat">
								<option value="${goodsCategoryTree.id }" ${goodsCategoryTree.isLeaf == '0' ? 'disabled': '' } 
								${requestScope.goods.cateId == goodsCategoryTree.id ? 'selected' : '' }>${goodsCategoryTree.treeName }</option>
							</c:forEach>
						</select>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-2">品牌：</label>
					<div class="formControls col-2">
						<select name="brandId"  class="input-text">
							<!-- disabled="disabled" 使某个失效-->
							<c:forEach items="${requestScope.goodsBrandList }" var="goodsBrand" varStatus="stat">
								<option value="${goodsBrand.id }" >${goodsBrand.name }</option>
							</c:forEach>
						</select>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-2"><span class="c-red">*</span>名称(前台显示)：</label>
					<div class="formControls col-5">
						<input type="text" class="input-text" value="${requestScope.goods.name }" placeholder="" id=""
							name="name">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-2"><span class="c-red">*</span>标题(后台显示)：</label>
					<div class="formControls col-5">
						<input type="text" class="input-text" value="${requestScope.goods.title }" placeholder="" id=""
							name="title">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-2"><span class="c-red">*</span>url：</label>
					<div class="formControls col-5">
						<input type="text" class="input-text" value="${requestScope.goods.url }" placeholder="" id=""
							name="url">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-2"><span class="c-red">*</span>重量：</label>
					<div class="formControls col-5">
						<input type="text" class="input-text" value="${requestScope.goods.weight }" placeholder="" id=""
							name="weight">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-2"><span class="c-red">*</span>库存量：</label>
					<div class="formControls col-5">
						<input type="text" class="input-text" value="${requestScope.goods.remainNum }" placeholder="" id=""
							name="remainNum">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-2"><span class="c-red">*</span>市场价：</label>
					<div class="formControls col-5">
						<input type="text" class="input-text" value="${requestScope.goods.marketPrice }" placeholder="" id=""
							name="marketPrice">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-2"><span class="c-red">*</span>折扣价：</label>
					<div class="formControls col-5">
						<input type="text" class="input-text" value="${requestScope.goods.price }" placeholder="" id=""
							name="price">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-2">图片：</label>
					<div class="formControls col-2">
						<input type="file" class="input-text" name="file">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-2">原始图片：</label>
					<div class="formControls col-2">
						<img title="国内品牌" src="${websitePath }${goods.listImgPath}" height="100" width="150">
					</div>
				</div>
				<div class="row cl">
					<%-- Date sys_now = new Date() --%>
					<%-- <jsp:useBean id="sys_now" class="java.util.Date"/> --%>
					<%--上面的被移动到了page.jsp中,这样就可以全局使用 --%>
					<label class="form-label col-2"><span class="c-red">*</span>发布日期：</label>
					<div class="formControls col-2">
						<input type="text" name="pubTime" value="<fmt:formatDate value="${requestScope.goods.pubTime }" pattern="yyyy-MM-dd HH:mm:ss"/>" class="input-text"
							style="width: 160px" placeholder="发布时间" 
							onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-2">状态：</label>
					<div class="formControls col-2 skin-minimal">
						<input type="radio" name="status" id="status1" value="1"
						${requestScope.goods.status == '1' ? 'checked' : '' }><label for="status1">启用</label>
						<input type="radio" name="status" id="status0" value="0" ${requestScope.goods.status == '0' ? 'checked' : '' }>
						<label for="status0">禁用</label>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-2">内容：</label>
					<div class="formControls col-10 ">
						<!-- 百度编辑器的内容 -->
						<script id="editor" name="content" type="text/plain" style="width:800px;height:250px;">${requestScope.goods.content }</script>
					</div>
				</div>
				<div class="row cl">
					<div class="col-10 col-offset-2">
						<span class="c-red">${info }</span>
					</div>
				</div>
				<div class="row cl">
					<div class="col-10 col-offset-2">
						<button class="btn btn-primary radius" type="submit">
							<i class="Hui-iconfont">&#xe632;</i> 保存
						</button>
						<button onClick="layer_close();" class="btn btn-default radius"
							type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
					</div>
				</div>
			</form>
		</div>
		</div>
	</body>
</html>
<script type="text/javascript">
//实例化编辑器
//建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
/* editor是id为editor百度编辑器存储的位置 */
var ue = UE.getEditor('editor');
</script>